package com.bwie.xujiahaonewstitle.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * 项目名称
 * 类描述：
 * 创建人：${徐家浩}
 * 创建时间：2017/2/23 18:16
 * 修改人：${徐家浩}
 * 修改备注：
 */
public class TitleAdapter extends FragmentPagerAdapter{
    private List<Fragment> list;
    private Context context;
    private String[] title;
    public TitleAdapter(FragmentManager fm, Context context, String[] title) {
        super(fm);
        this.context=context;
        this.title=title;
    }

    public void setList(List<Fragment> list) {
        this.list = list;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

}
